﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Zhaoxi.S7Lib
{
    /// <summary>
    /// S7协议PLC请求参数
    /// 需要读取一个地址下的特定类型的数据，读N个
    /// </summary>
    public class DataParameter
    {
        /// <summary>
        /// 数据区块
        /// </summary>
        public Areas Area { get; set; }
        /// <summary>
        /// 数据块号，仅当Area为DB时有效 
        /// </summary>
        public ushort DBNumber { get; set; } = 0;
        // 请求的时候   byte
        /// <summary>
        /// 读取数据类型
        /// </summary>
        public ParameterVarType PVarType { get; set; }
        /// <summary>
        /// 返回数据类型
        /// </summary>
        public DataVarType DVarType { get; set; }
        /// <summary>
        /// 字节地址
        /// </summary>
        public int ByteAddress { get; set; }
        /// <summary>
        /// 位地址
        /// </summary>
        public byte BitAddress { get; set; }
        /// <summary>
        /// 读多少个 - 设置请求的数据块数量
        /// </summary>
        public int Count { get; set; } = 1;
        /// <summary>
        /// 返回结果
        /// </summary>
        public byte[] DataBytes { get; set; }
    }
}
